{% extends "book/base.html" %}
{% load static paragraphedit %}
{% block pagetitle %}《{{book.title}}》 -- {{bookpage.title_html}}
{% endblock %}
{% block keymeta %}{{book.title}};{{book.author}}{% endblock %}
{% block keydesc %}{{book.title}}VIP章节,{{book.title}}无弹窗最新章节,{{book.title}}小说是一部非常好的{{book.category}}类小说,本站还提供玄幻,武侠,网游,都市,军事等类别的小说免费阅读,好小说尽在看小说么{% endblock %}
{% block headerjs %}{{ block.super }}
  <script>
    var DATA_DIC = DATA_DIC || {};
    DATA_DIC["is_page"]          = true;
    DATA_DIC["login_url"]        = "{% url 'login' %}";
    DATA_DIC["add_bookmark_url"] = "{% url 'add_bookmark' %}";
    DATA_DIC["invert"]           ={% if invert %}true;{% else %}false;{% endif %}
  </script>
  {% if user.is_superuser %}
    <style>
      .pagecontent > p:hover {
        cursor: pointer;
        background-color: #FFFCD5;
      }
    </style>
  {% endif %}
{% endblock %}
{% block content %}
  <div id="FIELD" class="row">
    <div class="col-md-12">
      <ol class="breadcrumb inv">
        <li class="hidden-xs">
          <a href="/">书籍列表</a>
        </li>
        <li>
          <a href="{{book.get_category_url}}">{{book.category}}</a>
        </li>
        <li>
          <a href="{% url 'bookinfo' book.pk %}">{{book.title}}</a>
        </li>
        <li>
          <a href="{% url 'bookindex' book.pk %}">书目</a>
        </li>
        <li class="active hidden-xs">{{bookpage.title_html}}</li>
      </ol>
    </div>
    <div class="col-md-12 text-center">
      <h2 class="text-center hidden-xs">{{bookpage.title_html}}</h2>
      <h5 class="text-center visible-xs">{{bookpage.title_html}}</h5>
      {% if user.is_superuser %}
        <div style="margin-bottom:5px;" class="col-md-12">
          <div class="btn-group text-center">
            <a
              href="javascript:;"
              data-churl="{% url 'pagetaskcheck' bookpage.pk %}"
              data-url="{% url 'pagefixpic' bookpage.pk %}"
              class="btn btn-warning btn-sm pagefixpic">更新图片章节</a>
            <a href="javascript:location.reload(true);" class="btn btn-success btn-sm">刷新当前页面</a>
          </div>
          <div class="empty">&nbsp;</div>
          <div role="alert" style="display:none;" class="alert alert-info"></div>
        </div>
      {% endif %}
      <div class="btn-group">
        <a href="{% url 'bookindex' book.pk %}" class="btn btn-primary">回目录</a>
        {% if user.is_authenticated %}
          <a href="javascript:;" data-pn="{{bookpage.pk}}" class="btn btn-info TBMABtn">加入书签</a>
        {% else %}
          <a href="{% url 'login' %}" data-pn="{{bookpage.pk}}" class="btn btn-info">加入书签</a>
        {% endif %}
        <a href="javascript:;" class="btn btn-primary invert">昼／夜</a>
      </div>
      <div class="text-center pagebookmarkalert">
        <div
          role="alert"
          id="TBMA{{bookpage.pk}}"
          style="display:none;"
          class="alert alert-info">书签已添加, 请到<strong>书架</strong>查看</div>
        <div
          role="alert"
          id="TBMAERR{{bookpage.pk}}"
          style="display:none;"
          class="alert alert-danger"></div>
      </div>
    </div>
    <div class="col-md-12 hidden-xs">&nbsp;</div>
    <div class="col-md-1 hidden-xs">&nbsp;</div>
    <div
      data-pageurl="{{bookpage.content_file.url|slice:':-3'}}"
      data-pagenum="{{bookpage.pk}}"
      data-dellurl="{% url 'del_line' bookpage.pk %}"
      class="col-md-10 pagecontent noload inv">
      <div class="col-md-5 hidden-lg hidden-md hidden-sm transparent_class PGDOWN"></div>
      <div class="col-md-5 hidden-lg hidden-md hidden-sm transparent_class PGUP"></div>
    </div>
    <div class="col-md-1 hidden-xs">&nbsp;</div>
    <div class="col-md-12 text-center pagebutton">
      <div class="btn-group">
        {% if bookpage.prev_number %}
          <a
            href="{% url 'bookpage' bookpage.prev_number %}"
            class="btn btn-success prev_page_a">
            <span class="fui-arrow-left"></span>
            <span>上一页</span>
          </a>
        {% else %}
          <a href="{% url 'bookindex' book.pk %}" class="btn btn-success prev_page_a">
            <span class="fui-arrow-left"></span>
            <span>上一页</span>
          </a>
        {% endif %}
        <a href="{% url 'bookindex' book.pk %}" class="btn btn-primary">回目录</a>
        {% if bookpage.next_number %}
          <a
            href="{% url 'bookpage' bookpage.next_number %}"
            class="btn btn-success next_page_a">
            <span>下一页</span>
            <span class="fui-arrow-right"></span>
          </a>
        {% else %}
          <a href="{% url 'bookindex' book.pk %}" class="btn btn-success next_page_a">
            <span>下一页</span>
            <span class="fui-arrow-right"></span>
          </a>
        {% endif %}
      </div>
      <div class="col-xs-12">&nbsp;</div>
      <div class="col-md-10 col-md-offset-1 text-center pagebutton">
        <div id="BMA" role="alert" style="display:none;" class="alert alert-info">书签已添加, 请到<strong>书架</strong>查看</div>
        <div id="BMAERR" role="alert" style="display:none;" class="alert alert-danger"></div>
      </div>
    </div>
    {% if user.is_superuser %}
      <div class="col-md-12 text-center bottombtn">
        <a target="_blank" href="/admin/book/bookpage/{{bookpage.pk}}/">编辑本章</a>
      </div>
    {% endif %}
    <div class="col-md-12">
      <hr/>
    </div>
    {% if bookpage.next_number %}
      <div class="col-md-12 text-center bottombtn nextbox">
        <a data-pn="{{bookpage.pk}}" href="javascript:;" class="readnall text-center">阅读后续10章</a>
      </div>
    {% endif %}
  </div>
{% endblock %}
{% block footerblock %}
  {% if user.is_superuser %}
    <div class="modal fade">
      <div class="modal-dialog">
        <div class="modal-content">
          <form id="Lineedit" action="{% url 'lineupdate' %}" method="post">
            <div class="modal-header">
              <button type="button" data-dismiss="modal" class="close">
                <span aria-hidden="true">&times;</span>
                <span class="sr-only">Close</span>
              </button>
              <h4 class="modal-title">段落编辑</h4>
            </div>
            <div class="modal-body">
              <textarea name="pageline" style="width: 100%;height: 150px;resize: none;"></textarea>
              <input type="hidden" value="" name="linenum"/>
              <input type="hidden" value="" name="pagenum"/>
              <div
                id="Savelinedone"
                style="display:none;"
                role="alert"
                class="alert alert-warning">保存成功!</div>
            </div>
            <div class="modal-footer">
              <button id="Closemodal" type="button" class="btn btn-default">关闭</button>
              <button id="Delline" type="button" class="btn btn-danger">删除本行</button>
              <button type="submit" class="btn btn-primary">保存改动</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  {% endif %}
{% endblock %}
